home *** CD-ROM | disk | FTP | other *** search
| Text File | 1989-05-01 | 6.0 KB | 193 lines | [TEXT/MPS ] |
- % ---------------------------------------------------------------------------
- % Class MACControl
- %
- % In this module you find the programmers interface to Controls.
- % It is built on top of the TOOLBOX routines in TOOLBOXControl.
- % For a description of the routines see Inside Macintosh, chapter 10.
- %
- % 890317/Boris Magnusson
- % 890408/Göran Eriksson
- %
- % ---------------------------------------------------------------------------
- % Datastructures used by the Control Manager
- %
- % ControlPtr = ^ControlRecord;
- %
- % ControlRecord = PACKED RECORD
- % nextControl: ControlHandle;
- % contrlOwner: WindowPtr;
- % contrlRect: Rect;
- % contrlVis: Byte;
- % contrlHilite: Byte;
- % contrlValue: INTEGER;
- % contrlMin: INTEGER;
- % contrlMax: INTEGER;
- % contrlDefProc: Handle;
- % contrlData: Handle;
- % contrlAction: ProcPtr;
- % contrlrfCon: LONGINT;
- % contrlTitle: Str255;
- % END; {ControlRecord}
- external text procedure Text_String="::SInterfaces:Text_String";
- external text procedure String_Text="::SInterfaces:String_Text";
- external class MacPoint="::SInterfaces:MacPoint";
- external class MacRect="::SInterfaces:MacRect";
- external class MacWindow="::SInterfaces:MacWindow";
- External class ToolboxControl ="::SInterfaces:ToolboxControl";
- ToolboxControl class Maccontrol;
- begin
- integer ControlPtr;
-
- % FUNCTION NewControl(curWindow: WindowPtr; boundsRect: Rect; title: Str255;
- % visible: BOOLEAN; value: INTEGER; min: INTEGER;
- % max: INTEGER; contrlProc: INTEGER;
- % refCon: LONGINT): ControlHandle;
- PROCEDURE NewControl(curWindow, boundsRect, title,
- visible, x_value, min, max, contrlProc,refCon);
- ref(MacWindow) curWindow;
- ref(MacRect) boundsRect;
- text title;
- boolean visible;
- short integer x_value, min, max;
- short integer contrlProc;
- integer refCon;
- begin
- text temp;
- temp:-text_string(title);
- ControlPtr:=ToolboxNewControl(curWindow.WindowPtr,
- boundsRect.top, temp,visible, x_value, min, max,
- contrlProc,refCon);
- end;
-
- % FUNCTION GetNewControl(controlID: INTEGER; owner: WindowPtr): ControlHandle;
- procedure GetNewControl( controlID, owner);
- short integer controlID;
- integer owner;
- begin
- ControlPtr:=ToolboxGetNewControl(controlID, owner);
- end;
-
- % PROCEDURE MoveControl(theControl: ControlHandle; h, v: INTEGER);
- PROCEDURE MoveControl( h, v);
- short integer h,v;
- ToolboxMoveControl(ControlPtr, h, v);
-
- % PROCEDURE SizeControl(theControl: C buildtoolbox , h: INTEGER);
- PROCEDURE SizeControl( w, h);
- short integer h,w;
- ToolboxSizeControl(ControlPtr, w, h);
-
- % PROCEDURE DragControl(theControl: ControlHandle; startPt: Point; bounds: Rect;
- % slopRect:rect, axis:integer);
- PROCEDURE DragControl(startPt, bounds,
- slopRect, axis);
- name bounds, slopRect;
- ref(MacPoint) startPt;
- ref(MacRect) bounds, slopRect;
- short integer axis;
- begin
- ref(MacRect) LocalBounds,LocalSlopRect;
- LocalBounds:-Bounds;
- LocalSlopRect:-SlopRect;
- ToolboxDragControl(ControlPtr, startPt.h, StartPt.v,
- LocalBounds.Top, LocalSlopRect.Top, axis);;
- Bounds:-LocalBounds;
- SlopRect:-LocalSlopRect;
- end;
-
- % PROCEDURE ShowControl(theControl: ControlHandle);
- PROCEDURE ShowControl;
- ToolboxShowControl(ControlPtr);
-
- % PROCEDURE HideControl(theControl: ControlHandle);
- PROCEDURE HideControl;
- ToolboxHideControl(ControlPtr);
-
- % PROCEDURE SetCTitle(theControl: ControlHandle; title: Str255);
- PROCEDURE SetCTitle(title);
- text title;
- begin
- text temp;
- temp:-Text_String(title);
- ToolboxSetCTitle(ControlPtr, temp);
- end;
-
- % PROCEDURE GetCTitle(theControl: ControlHandle; VAR title: Str255);
- PROCEDURE GetCTitle( title);
- name title;
- text title;
- begin
- text temp;
- temp:-Text_String(title);
- ToolboxGetCTitle(ControlPtr, temp);
- title:-String_Text(Temp);
- end;
-
- % PROCEDURE HiliteControl(theControl: ControlHandle; hiliteState: INTEGER);
- PROCEDURE HiliteControl(hiliteState);
- short integer hiliteState;
- ToolboxHiliteControl(ControlPtr, hiliteState);
-
- % PROCEDURE SetCRefCon(theControl: ControlHandle; data: LONGINT);
- PROCEDURE SetCRefCon( data);
- integer data;
- ToolboxSetCRefCon(ControlPtr, data);
-
- % FUNCTION GetCRefCon(theControl: ControlHandle): LONGINT;
- integer procedure GetCRefCon;
- GetCRefCon:=ToolboxGetCRefCon(ControlPtr);
-
- % PROCEDURE SetCtlValue(theControl: ControlHandle; theValue: INTEGER);
- PROCEDURE SetCtlValue(theValue);
- short integer theValue;
- ToolboxSetCtlValue(ControlPtr, theValue);
-
- % FUNCTION GetCtlValue(theControl: ControlHandle): INTEGER;
- short integer procedure GetCtlValue;
- GetCtlValue:=ToolboxGetCtlValue(ControlPtr);
-
- % FUNCTION GetCtlMin(theControl: ControlHandle): INTEGER;
- short integer procedure GetCtlMin;
- GetCtlMin:=ToolboxGetCtlMin(ControlPtr);
-
- % FUNCTION GetCtlMax(theControl: ControlHandle): INTEGER;
- short integer procedure GetCtlMax;
- GetCtlMax:=ToolboxGetCtlMax(ControlPtr);
-
- % PROCEDURE SetCtlMin(theControl: ControlHandle; theValue: INTEGER);
- PROCEDURE SetCtlMin(theValue);
- short integer theValue;
- ToolboxSetCtlMin(ControlPtr, theValue);
-
- % PROCEDURE SetCtlMax(theControl: ControlHandle; theValue: INTEGER);
- PROCEDURE SetCtlMax(theValue);
- short integer theValue;
- ToolboxSetCtlMax(ControlPtr, theValue);
-
- % FUNCTION GetCtlAction(theControl: ControlHandle): ProcPtr;
- integer procedure GetCtlAction;
- GetCtlAction:=ToolboxGetCtlAction(ControlPtr);
-
-
- % PROCEDURE SetCtlAction(theControl: ControlHandle; newProc: ProcPtr);
- PROCEDURE SetCtlAction(newProc);
- integer newProc;
- ToolboxSetCtlAction(ControlPtr, newProc);
-
-
- % FUNCTION TestControl(theControl: ControlHandle; thePt: Point): INTEGER;
- short integer procedure TestControl(thePt);
- ref(MacPoint) thePt;
- TestControl:=ToolboxTestControl(ControlPtr, thePt.h, thePt.v);
-
- % FUNCTION TrackControl(theControl: ControlHandle; thePt: Point;
- % actionProc: ProcPtr): INTEGER;
- short integer procedure TrackControl(thePt, actionProc);
- ref(MacPoint) thePt;
- integer actionProc;
- TrackControl:=ToolboxTrackControl(ControlPtr,thePt.h,thePt.v,
- actionProc);;
-
-
-
- end;